UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'opEJOsg2SnKYh6NroHJ9UtwoEJI1lC+J3RegZs2TuNk='
WHERE
key_id = '31f91bb61c045c5d68cfeb6faa8738b4212a304392a3acb51af17b8d6c80cf37'
AND (
token = 'opEJOsg2SnKYh6NroHJ9UtwoEJI1lC+J3RegZs2TuNk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)