UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aFXr79gthZpIbXxzGA2hE8rr4DfbsYqGb7f9uvgb0Mg=' 
WHERE 
  key_id = 'fdcdfe36093d71ba02e3251e85ab4842357313285574e15693007c86c9bcd25b' 
  AND (
    token = 'aFXr79gthZpIbXxzGA2hE8rr4DfbsYqGb7f9uvgb0Mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034