UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Oj6YjIfzwotheLTd9yU6o0/Y3vL6e7etZnuf3w2ijvA='
WHERE
key_id = '8ca2c06721e13c974e89d718ee5bcd90e34f1bee4e7260afb5d3a18756b56f4b'
AND (
token = 'Oj6YjIfzwotheLTd9yU6o0/Y3vL6e7etZnuf3w2ijvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)