UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6NePeTS+UZM2iJcSeWkkmpaE0Zq73LH7XKDQF/9XFX8=' 
WHERE 
  key_id = '4e1a11fc71fbc2b8464369df07774660b2d11da904b12905d89db365c9182102' 
  AND (
    token = '6NePeTS+UZM2iJcSeWkkmpaE0Zq73LH7XKDQF/9XFX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043