UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E8ICSKQza5W/+IW5vqqS0THompkPuVtqBDgcD76ctnM='
WHERE
key_id = 'f7d2dd50c9bdd5be0672580d53bf9b612b2a34c39a9b03658192854cb4472b6b'
AND (
token = 'E8ICSKQza5W/+IW5vqqS0THompkPuVtqBDgcD76ctnM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)