UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AVcYJAiQbQF2Ca0D2/bjsDQambHV3CWLbn121hJR9Vs=' 
WHERE 
  key_id = '02e75e17b2b15037615fcb328ae679411c4407a7573a03a10b8bcaff279718ac' 
  AND (
    token = 'AVcYJAiQbQF2Ca0D2/bjsDQambHV3CWLbn121hJR9Vs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041