UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CM89Jk8qTpHhvCtWMcCtZazynHv8ODxcbCuYyo90GFY=' 
WHERE 
  key_id = 'd24bb02205c25aaa3f1ae65f110e6b1532ac85de9b449ab54fb2aec0c4060421' 
  AND (
    token = 'CM89Jk8qTpHhvCtWMcCtZazynHv8ODxcbCuYyo90GFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029