UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'alm3RUL2Rn8X+5+CxwBdfNieLSZzbIWgErJHedRHRqU='
WHERE
key_id = '815874347ad6c56e266b6f397af32d947d7839f3c95651da5e7e2b66206477de'
AND (
token = 'alm3RUL2Rn8X+5+CxwBdfNieLSZzbIWgErJHedRHRqU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)