UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cDDoYGxsYmwfjO3KduU2zcDFQzAEKazMburARo/ndpw='
WHERE
key_id = 'e6f83e621b73230b7f4474f81849617a26b6f98fbf6057f0982e183c7a9a3a4a'
AND (
token = 'cDDoYGxsYmwfjO3KduU2zcDFQzAEKazMburARo/ndpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)