UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OsxWKgCsjGgHMdG+kMkzebvCTGBQ33MgbB4fGT86cMY=' 
WHERE 
  key_id = '00864cb2aa1bc9b7532c1d9c5d0361922b641689d6342ab91308a37011d2d6f2' 
  AND (
    token = 'OsxWKgCsjGgHMdG+kMkzebvCTGBQ33MgbB4fGT86cMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029