UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p7+1jU5IlCHVIMSOUUhFjK7vyfE6tC0UhuZMp3pRuvk=' 
WHERE 
  key_id = '1d04a6007fd334d07b9bebed79aaa473f97ba4c7b91b6f440391283fec62697c' 
  AND (
    token = 'p7+1jU5IlCHVIMSOUUhFjK7vyfE6tC0UhuZMp3pRuvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017