UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vVb7vxat6qYwwFAOxRWedS4sbHfcucZZW2S5FpthKvw=' 
WHERE 
  key_id = '05bc8e6b0b1976d1b0f9afc0b0c83e16ef25fcf11ed251e57c59d6fc15947539' 
  AND (
    token = 'vVb7vxat6qYwwFAOxRWedS4sbHfcucZZW2S5FpthKvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048