UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ny1xFIUBqxgmt+m1DQvoy1BRwuWY6ge7ThLRVNtHgk=' 
WHERE 
  key_id = 'b8661a8531d5d63d727297684f1423f90d5db5faab60446081d71bfa4ca6717a' 
  AND (
    token = '8ny1xFIUBqxgmt+m1DQvoy1BRwuWY6ge7ThLRVNtHgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046