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