UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a1RaUg9+plXIeK3ORZYWeW/ZNHBStBBr29O6RQEmQpA='
WHERE
key_id = 'a31b8ed692dff80722519b8ca12f87f8a6fa38f6abeb81a0391db85dd827545b'
AND (
token = 'a1RaUg9+plXIeK3ORZYWeW/ZNHBStBBr29O6RQEmQpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)