UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OAi+9ap4VLi0aMOcnCdN92iD9i1oxqUedWWP0VAN9wg=' 
WHERE 
  key_id = '1a7ac3937423dc315ea0f339585fee36179d2b75051e7302f4b7b3615787a135' 
  AND (
    token = 'OAi+9ap4VLi0aMOcnCdN92iD9i1oxqUedWWP0VAN9wg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038