UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sR0UpnXjRBW8XQLB2Gx7TA6Dt8PQOOnfWGCgvqA/w+Q='
WHERE
key_id = 'a6da3d48c9e915415ce01c0133ecee799559c434ee39c7408b48528eb9ca3179'
AND (
token = 'sR0UpnXjRBW8XQLB2Gx7TA6Dt8PQOOnfWGCgvqA/w+Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)