UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KDYoRFXQX7wnJgjX2q6JDra9jhquT6IMVZGWBtpiCts=' 
WHERE 
  key_id = '6be06f7172386fe8e3910749b6edaf96efd64f0214cf2bc3aabf342725c65636' 
  AND (
    token = 'KDYoRFXQX7wnJgjX2q6JDra9jhquT6IMVZGWBtpiCts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036