UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z0HCGF63pHX6dsDEOXgjnmzzQYfpb6tOXBUtl8m8jpU=' 
WHERE 
  key_id = '3200e62c73f8ab8b4ea877ac4868f2043b070c072d19c220875897c36df0b071' 
  AND (
    token = 'z0HCGF63pHX6dsDEOXgjnmzzQYfpb6tOXBUtl8m8jpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045