UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AEOeid4TiU5FkFltlsRLgfzBGkY3RG3vJZSAKCsancM='
WHERE
key_id = 'ef8e9f4f320ff49c9af85a70c775d835ee48dc9082a84555b7dbdd7db545dac2'
AND (
token = 'AEOeid4TiU5FkFltlsRLgfzBGkY3RG3vJZSAKCsancM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)