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

Query time 0.00039