UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BupY1yYgi7A46/+tNUxRh7mlyjicHoC+tpBxut7T7TA='
WHERE
key_id = '2ae6babf794105e23f3fc253a2edd723d65d46af12a4e3fd2bb1fe8c3a7d2989'
AND (
token = 'BupY1yYgi7A46/+tNUxRh7mlyjicHoC+tpBxut7T7TA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)