UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RSxwGu4wbHjus0034VPlTIah+NnhYMkelZHSxThihxM=' 
WHERE 
  key_id = '04e0c0be663dc976b0f377b028a6f2ab4da7960b8c4e41d1bba0d3fa479c23b5' 
  AND (
    token = 'RSxwGu4wbHjus0034VPlTIah+NnhYMkelZHSxThihxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025