UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jEyqsg6HigdNta9BY/aCqiBYS/gz0X4x9pPfS3PGW9w='
WHERE
key_id = 'edea7285a198a7c709993d836a33f066c2e10831d70c1390016f74db5bfb84c5'
AND (
token = 'jEyqsg6HigdNta9BY/aCqiBYS/gz0X4x9pPfS3PGW9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)