UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EJrjvhnkHRQ7Av0vcU0yPj9Ke+h9SSRI2hGc+y2Wv34='
WHERE
key_id = 'b70e678891d27458e5052c944adf0c052d1c8e818f1f45f93ec5cf4b90861301'
AND (
token = 'EJrjvhnkHRQ7Av0vcU0yPj9Ke+h9SSRI2hGc+y2Wv34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)