UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LA6821hSQwezqL4LY6azWhVFMCFqhj02UX0/vilASAU=' 
WHERE 
  key_id = '7d88bbbbcd0620eb033f99b95f82e0809b77b99482965518d5e0ad358d9758d7' 
  AND (
    token = 'LA6821hSQwezqL4LY6azWhVFMCFqhj02UX0/vilASAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034