UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SwCUssNUWF8xq2gLU33k706cIZyWmUp7Sy8K9qHnhHg='
WHERE
key_id = '5838edf0794399d209265ee4435e1bae2b1f851531d67699afab75a97237b0eb'
AND (
token = 'SwCUssNUWF8xq2gLU33k706cIZyWmUp7Sy8K9qHnhHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)