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