UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ivlyMx9+JKnCAT1iwYVtAh7YPL5EeVlWVUBC3Ec+1DY=' 
WHERE 
  key_id = '285a94630ceec001402ea2e9d5fa79f177975d0a9c30adb4e1e1bbcfa10829fa' 
  AND (
    token = 'ivlyMx9+JKnCAT1iwYVtAh7YPL5EeVlWVUBC3Ec+1DY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029