UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's8XDjbEt+yKXdKT7Z82b1qM2TkoEEhiDnWn8j1bS4AQ='
WHERE
key_id = '56bb0b33029b7c710a6469b6b077eba8ccadf64e8010fe78207d109213faa77b'
AND (
token = 's8XDjbEt+yKXdKT7Z82b1qM2TkoEEhiDnWn8j1bS4AQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)