UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qRB+Kiwe3xRMiKIcGPoHVhzubxW/VeN0hATPdiGZvFw=' 
WHERE 
  key_id = '5cf451a31c66179ab8c3dca3c1263d519b3739d7f11b010411b5aeb8d63e7af6' 
  AND (
    token = 'qRB+Kiwe3xRMiKIcGPoHVhzubxW/VeN0hATPdiGZvFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040