UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rTgke1SainMKEV+fBWfIdZDNx6bAvqaA6tyAfwXJEH4='
WHERE
key_id = '222af341cbd64fd215c677aefada6a6d3c58be3b587b6b33b1a9c35d16ef5a0b'
AND (
token = 'rTgke1SainMKEV+fBWfIdZDNx6bAvqaA6tyAfwXJEH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)