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