UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IydbZxjXKNVgnoEqLX0Xaj3hiVRU9CdjA3EqzZBheiE='
WHERE
key_id = '574944433231ad0d518ca4af5cdb0240b2e151f6aa0ea02583054538445b583c'
AND (
token = 'IydbZxjXKNVgnoEqLX0Xaj3hiVRU9CdjA3EqzZBheiE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)