UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hf1775SYy9eu+AnEGXYAvDSan+MLc6+9DgtccHblMnk=' 
WHERE 
  key_id = '286b10b9db1ba740dcf12b2554843e52b3108f16bdbf60658330da0cc3c19bb6' 
  AND (
    token = 'Hf1775SYy9eu+AnEGXYAvDSan+MLc6+9DgtccHblMnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043