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