UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N1wTuekbib9qLVkWSilG1WcnJU4cY4Nl4tcmXeiaE/A='
WHERE
key_id = 'd409a5388e9d667d14271531980f9bb59d576d66004273f84f291774b7489692'
AND (
token = 'N1wTuekbib9qLVkWSilG1WcnJU4cY4Nl4tcmXeiaE/A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)